﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GeneralClasses
{
    /// <summary>
    /// Contains data that is shared amongst schedules during a schedule creation run
    /// such as salary cap, nurses, number of days, etc...
    /// 
    /// To get the count of Departments, Shifts, and Persons, just type ScheduleData.Departments.Count, 
    /// ScheduleData.Shifts.Count and ScheduleData.Persons.Count.
    /// </summary>
    public class ScheduleData
    {
        #region variables
        private DateTime startDate;
        private int numDays;
        private List<Department> departments;
        private List<Shift> shifts;
        private List<Person> persons;
        #endregion

        #region PROPERTIES
        public DateTime StartDate
        {
            get
            {
                return startDate;
            }
            set
            {
                startDate = value;
            }
        }

        public int NumDays
        {
            get
            {
                return numDays;
            }
            set
            {
                numDays = value;
            }
        }

        public List<Department> Departments
        {
            get
            {
                return departments;
            }
            set
            {
                departments = value;
            }
        }

        public List<Shift> Shifts
        {
            get
            {
                return shifts;
            }
            set
            {
                shifts = value;
            }
        }

        public List<Person> Persons
        {
            get
            {
                return persons;
            }
            set
            {
                persons = value;
            }
        }

        public List<Nurse> deprecated_Nurses
        {
            get
            {
                return new List<Nurse>();
            }
        }

        #endregion

        #region CONSTRUCTOR
        public ScheduleData() { }


        public ScheduleData(Schedule schedule)
        {
            startDate = schedule.StartDate;
            TimeSpan timeSpan = schedule.EndDate.Subtract(schedule.StartDate);
            numDays = timeSpan.Days;
            departments = schedule.DepartmentMasterList;
            persons = Person.loadAllActiveNurses();
            shifts = schedule.ShiftMasterList;
        }
        #endregion


        public int GetNumNursesPerDepartment(int index)
        {
            return departments[index].PeopleNeeded;
        }
    }
}
